import Vue from 'vue'
import Router from 'vue-router'

const _import = require('./_import_' + process.env.NODE_ENV)
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'
import customerProfile from '../views/customerProfile.vue'
import customerQuery from '../views/InfoRetrieval/CustomerProfile/customerProfile.vue'
import machineQuery from '../views/machineQuery.vue'
import filter from '../views/filter.vue'
import survey from '../views/deepInsight/survey'
import testW from '../views/Depthanalysis/Activation'
import menuLayout from '../views/Depthanalysis/menuLayout/menuLayout'

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    role: ['admin','editor']     will control the page role (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if fasle ,the page will no be cached(default is false)
  }
 **/
export const constantRouterMap = [
  {path: '/login', component: _import('login/index'), hidden: true},
  {path: '/authredirect', component: _import('login/authredirect'), hidden: true},
  {path: '/404', component: _import('errorPage/404'), hidden: true},
  {path: '/faq', component: _import('functional/faq'), hidden: true},
  {path: '/guide', component: _import('numberpage/QuanX'), hidden: true},
  // {path: '/aboutus', component: _import('numberpage/aboutus'), hidden: true},
  {path: '/aboutus', component: _import('numberpage/aboutus33'), hidden: true},
  // {path: '/aboutus', component: _import('numberpage/aboutus44'), hidden: true},
  // {path: '/menuLayout', component: _import('menuLayout/menuLayout'), hidden: true},
  // {path: '/menuLayout', component: _import('deepInsight/loyaltyAnalysis'), hidden: true},
  {path: '/gdemo', component: _import('Gdemo'), hidden: true},
  {path: '/item', component: _import('newCustomerInfo'), hidden: true},
  {
    path: '/faqInside',
    component: Layout,
    redirect: '/faqInside/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('functional/faqInside'),
      name: 'faqInside'
    }]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/Overview',
    // menuLevel: 1,
    meta: {title: 'Overview', icon: 'icon-zonglan'},
    hidden: true,
  },
  {
    path: '/Overview',
    component: Layout,
    redirect: '/Overview/index',
    // menuLevel: 1,
    meta: {title: 'Overview', icon: 'icon-zonglan'},
    children: [{
      path: 'index',
      component: _import('overview/newOverView'),
      // component: _import('overview/newOverView1'),
      name: 'Overview',
      meta: {title: 'Dashboard', noCache: true}
    }]
  },
  {
    path: '/OverviewIntroduction',
    component: Layout,
    redirect: '/OverviewIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('Introduction/OverviewIntroduction'),
      name: 'OverviewIntroduction',
      meta: {
        title: 'OverviewIntroduction'
      }
    }]
  },
  {
    path: '/CustomerProfileIntroduction',
    component: Layout,
    redirect: '/CustomerProfileIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('Introduction/CustomerProfileIntroduction'),
      name: 'CustomerProfileIntroduction',
      meta: {
        title: 'CustomerProfileIntroduction',
      }
    }]
  },
  {
    path: '/DeepInsightIntroduction',
    component: Layout,
    redirect: '/DeepInsightIntroduction/index',
    hidden: true,
    meta: {},
    children: [{
      path: 'index',
      component: _import('Introduction/DeepInsightIntroduction1'),
      name: 'DeepInsightIntroduction',
      meta: {
        title: 'DeepInsightIntroduction',
      }
    }]
  }
  // {
  //   path: '/newSearchResult',
  //   component: Layout,
  //   redirect: '/newSearchResult/index',
  //   hidden: true,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('newSearchResult'),
  //     name: 'newSearchResult',
  //     meta: {
  //       title: 'newSearchResult',
  //       icon: 'lock'
  //     }
  //   }]
  // },
  // {
  //   path: '/SearchResult2',
  //   component: Layout,
  //   redirect: '/SearchResult2/index',
  //   hidden: true,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('searchResult2'),
  //     name: 'SearchResult2',
  //     meta: {
  //       title: 'SearchResult2',
  //       icon: 'lock'
  //     }
  //   }]
  // },
  // {
  //   path: '/filter',
  //   component: Layout,
  //   redirect: '/filter/index',
  //   hidden: true,
  //   children: [{
  //     path: 'index',
  //     component: _import('filter'),
  //     name: 'filter',
  //     meta: {title: 'filter', icon: 'documentation', noCache: true}
  //   }]
  // },
  // {
  //   path: '/filterResult',
  //   component: Layout,
  //   redirect: '/filterResult/index',
  //   hidden: true,
  //   children: [{
  //     path: 'index',
  //     component: _import('filterResult'),
  //     name: 'filterResult',
  //     meta: {title: 'filterResult', icon: 'documentation', noCache: true}
  //   }]
  // }
]

export default new Router({
  // mode: 'history', //后端支持可开
  // scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  {
    path: '/CustomerProfile',
    component: Layout,
    redirect: '/CustomerProfile/index',
    // menuLevel: 1,
    meta: {title: 'CustomerProfile', icon: 'icon-yonghuming'},
    children: [
      {
        path: 'index',
        component: customerQuery,
        name: 'CustomerProfile',
        hidden: false,
        meta: {
          title: 'CustomerProfile'
        }
      },
      {
        path: 'MachineQuery',
        component: machineQuery,
        name: 'MachineQuery',
        hidden: false,
        meta: {
          title: 'MachineQuery'
        }
      },
      {
        path: 'filter',
        component: filter,
        name: 'filter',
        hidden: false,
        meta: {
          title: 'Filter'
        }
      },
      {
        path: 'newSearchResult',
        component: _import('newSearchResult/newSearchResult'),
        name: 'newSearchResult',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'newSearchResult',
          icon: 'icon-information'
        }
      }, {
        path: 'SearchResult2',
        component: _import('searchResult2'),
        name: 'SearchResult2',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'SearchResult2',
          icon: 'icon-information'
        }
      }, {
        path: 'filterResult',
        component: _import('filterResult'),
        name: 'filterResult',
        noFilter: true,
        hidden: true,
        meta: {
          title: 'filterResult',
          icon: 'icon-information'
        }
      }
    ]
  },
  {
    path: '/DeepInsight',
    component: Layout,
    redirect: '/DeepInsight/CustomerInsight/testW',
    meta: {title: 'DeepInsight', icon: 'icon-iconfontpaixingbang', role: ['admin']},
    children: [
      {
        path: 'CustomerInsight',
        name: 'CustomerInsight',
        hidden: false,
        meta: {
          title: 'CustomerInsight'
        },
        component: menuLayout, //深度分析的三级菜单的公共容器
        children: [
          {
            path: 'testW',
            component: testW,
            name: 'testW',
            hidden: false,
            meta: {
              title: 'CustomerOverallTrend'
            }
          },
          {
            path: 'loyaltyAnalysis',
            component: _import('Depthanalysis/LoyaltyAnalysis'),
            name: 'loyaltyAnalysis',
            hidden: false,
            meta: {
              title: 'LoyaltyAnalysis'
            }
          },
          {
            path: 'CustomerValue',
            component: _import('Depthanalysis/CustomerValue'),
            name: 'CustomerValue',
            hidden: false,
            meta: {
              title: 'CustomerValue'
            }
          },
          {
            path: 'CustomerProfitability',
            component: _import('Depthanalysis/CustomerProfitability'),
            name: 'CustomerProfitability',
            hidden: false,
            meta: {
              title: 'CustomerProfitability'
            }
          }, {
            path: 'CustomerGrowth',
            component: _import('Depthanalysis/CustomerGrowth'),
            name: 'CustomerGrowth',
            hidden: false,
            meta: {
              title: 'CustomerGrowth'
            }
          },
          {
            path: 'CustomerRanking',
            component: _import('Depthanalysis/CustomerRanking'),
            name: 'CustomerRanking',
            hidden: false,
            meta: {
              title: 'CustomerRanking'
            }
          }
        ]
      },
      {
        path: 'ProductInsight',
        name: 'ProductInsight',
        hidden: false,
        meta: {
          title: 'ProductInsight'
        },
        component: menuLayout,
        children: [
          {
            path: 'ProductOverallTrend',
            component: _import('Depthanalysis/ProductOverallTrend'),
            name: 'OverallTrend',
            hidden: false,
            meta: {
              title: 'ProductOverallTrend'
            }
          },
          {
            path: 'Configguration',
            component: _import('Depthanalysis/Configguration1'),
            name: 'Configguration',
            hidden: false,
            meta: {
              title: 'NotebookConfiguration'
            }
          },
          {
            path: 'ProductProfitability',
            component: _import('Depthanalysis/ProductProfitability'),
            name: 'ProductProfitability',
            hidden: false,
            meta: {
              title: 'ProductProfitability'
            }
          }
        ]
      },
      {
        path: 'ShipmentTrackingInsight',
        name: 'ShipmentTrackingInsight',
        hidden: false,
        meta: {
          title: 'ShipmentTrackingInsight'
        },
        component: menuLayout,
        children: [
          {
            path: 'ShipmentOverallTrend',
            component: _import('Depthanalysis/ShipmentOverallTrend'),
            name: 'ShipmentOverallTrend',
            hidden: false,
            meta: {
              title: 'ShipmentOverallTrend'
            }
          }
        ]
      },
      {
        path: 'ServiceInsight',
        name: 'ServiceInsight',
        hidden: false,
        meta: {
          title: 'ServiceInsight'
        },
        component: menuLayout,
        children: [
          {
            path: 'ServiceOverallTrend',
            component: _import('Depthanalysis/ServiceOverallTrend'),
            name: 'ServiceOverallTrend',
            hidden: false,
            meta: {
              title: 'ServiceOverallTrend'
            }
          }
        ]
      },
      {
        path: 'SurveyResultInsight',
        name: 'SurveyResultInsight',
        hidden: false,
        meta: {
          title: 'SurveyResultInsight'
        },
        component: menuLayout,
        children: [
          {
            path: 'WWCX',
            component: survey,
            name: 'WWCX',
            hidden: false,
            meta: {
              title: 'WWCX'
            }
          }
        ]
      }
    ]
  },
  {
    path: '/SMBIntelligence',
    component: Layout,
    redirect: '/SMBIntelligence/PCactivation',
    meta: {title: 'SMBIntelligence', icon: 'icon-pingtaijiyewujiankong', role: ['admin']},
    children: [{
      path: 'Dashboard',
      component: _import('SMBIntelligence/Dashboard'),
      name: 'Dashboard',
      meta: {
        title: 'Dashboard'
      }
    }, {
      path: 'PCActivation',
      component: _import('SMBIntelligence/PCactivation'),
      name: 'PCActivation',
      meta: {
        title: 'PCActivation'
      }
    }, {
      path: 'DigitalCA',
      component: _import('SMBIntelligence/DigitalCA'),
      name: 'DigitalCA',
      meta: {
        title: 'DigitalCA'
      }
    }, {
      path: 'CAComparison',
      component: _import('SMBIntelligence/CAComparison'),
      name: 'CAComparison',
      meta: {
        title: 'CAComparison'
      }
    }]
  },
  // {
  //   path: '/PRCIntelligence',
  //   component: Layout,
  //   redirect: '/PRCIntelligence/index',
  //   menuLevel: 1,
  //   meta: {title: 'PRCIntelligence', icon: 'icon-ziliaoduibi'},
  //   children: [{
  //     path: 'index',
  //     component: _import('Depthanalysis/PRCIntelligence'),
  //     name: 'PRCIntelligence',
  //     meta: {
  //       title: 'PRCIntelligence',
  //       icon: 'icon-ziliaoduibi'
  //     }
  //   }]
  // },
  {
    path: '/Comparison',
    component: Layout,
    meta: {title: 'Comparison', icon: 'icon-drgspingtairuanjianxitong24', role: ['admin']},
    children: [{
      path: 'CBI_MSBenchmark',
      component: _import('Depthanalysis/CBI_MSBenchmark'),
      name: 'CBI_MSBenchmark',
      meta: {
        title: 'CBI_MSBenchmark'
      }
    },
    //   {
    //   path: 'CBI_MS',
    //   component: _import('Depthanalysis/CBI_MS'),
    //   name: 'CBI_MS',
    //   meta: {
    //     title: 'CBI_MS'
    //   }
    // },
      {
      path: 'CBI_Zyme',
      component: _import('Depthanalysis/CBI_Zyme'),
      name: 'CBI_Zyme',
      meta: {
        title: 'CBI_Zyme'
      }
    }]
  },
  {
    path: '/ReferenceInfo',
    component: Layout,
    // redirect: '/AboutUs/index',
    menuLevel: 2,
    meta: {title: 'ReferenceInfo', icon: 'icon-jibenziliao'},
    children: [{
      path: 'Fortune500Information',
      component: _import('ReferenceInfo/Fortune500Information'),
      name: 'Fortune500Information',
      meta: {
        title: 'Fortune500Information'
      }
    }]
  },
  {
    path: '/AboutUs',
    component: Layout,
    redirect: '/AboutUs/index',
    menuLevel: 1,
    meta: {},
    children: [{
      path: 'index',
      // component: _import('numberpage/aboutus2'),
      component: _import('Introduction/aboutus3'),
      // component: _import('Introduction/aboutus33'),
      name: 'AboutUs',
      meta: {
        title: 'AboutUs',
        icon: 'icon-guanyuwomen'
      }
    }]
  },
  {
    path: '/faqInside',
    component: Layout,
    redirect: '/faqInside/index',
    menuLevel: 1,
    meta: {},
    children: [{
      path: 'index',
      component: _import('functional/faqInside'),
      name: 'faqInside',
      meta: {
        title: 'Faq',
        icon: 'icon-wenda'
      }
    }]
  },
  // {
  //   path: '/menuLayout',
  //   component: Layout,
  //   redirect: '/menuLayout/index',
  //   menuLevel: 1,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('deepInsight/loyaltyAnalysis'),
  //     name: 'menuLayout',
  //     meta: {
  //       title: 'loyaltyAnalysis',
  //       icon: 'icon-wenda'
  //     }
  //   }]
  // },


  //
  // {
  //   path: '/error',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   name: 'errorPages',
  //   meta: {
  //     title: 'errorPages',
  //     icon: '404'
  //   },
  //   children: [
  //     { path: '401', component: _import('errorPage/401'), name: 'page401', meta: { title: 'page401', noCache: true }},
  //     { path: '404', component: _import('errorPage/404'), name: 'page404', meta: { title: 'page404', noCache: true }}
  //   ]
  // },
  //
  // {
  //   path: '/error-log',
  //   component: Layout,
  //   redirect: 'noredirect',
  //   children: [{ path: 'log', component: _import('errorLog/index'), name: 'errorLog', meta: { title: 'errorLog', icon: 'bug' }}]
  // },
  // {
  //   path: '/Intro-CustomerProfile',
  //   component: Layout,
  //   redirect: '/Intro-CustomerProfile/index',
  //   menuLevel: 1,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('TestIntroduction/Introduction'),
  //     name: 'Intro-CustomerProfile',
  //     meta: {
  //       title: 'menuLayout',
  //       icon: ''
  //     }
  //   }]
  // },
  // {
  //   path: '/Intro-Overview',
  //   component: Layout,
  //   redirect: '/Intro-Overview/index',
  //   menuLevel: 1,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('TestIntroduction/aboutus3'),
  //     name: 'Intro-CustomerProfile',
  //     meta: {
  //       title: 'test1',
  //       icon: ''
  //     }
  //   }]
  // },
  // {
  //   path: '/aboutus3',
  //   component: Layout,
  //   redirect: '/aboutus3/index',
  //   menuLevel: 1,
  //   meta: {},
  //   children: [{
  //     path: 'index',
  //     component: _import('TestIntroduction/aboutus3'),
  //     name: 'newAboutus',
  //     meta: {
  //       title: 'newAboutus',
  //       icon: ''
  //     }
  //   }]
  // },


  {path: '*', redirect: '/404', hidden: true}
]
